package com.wjh.yygh.controller;

import com.wjh.yygh.common.result.Result;
import com.wjh.yygh.model.hosp.Schedule;
import com.wjh.yygh.service.ScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * time: 2022/7/31
 * user:Wang Junhong
 */

@Api(tags = "排班管理")
@RestController
@RequestMapping("/admin/hosp/department")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation(value = "根据科室查询排版")
    @GetMapping("/getScheduleRule/{page}/{limit}/{hospcode}/{depcode}")
    public Result getScheduleRule(@PathVariable("page") Integer page
            , @PathVariable("limit") Integer limit
            , @PathVariable("hospcode") String hospcode
            , @PathVariable("depcode") String depcode) {

       Map<String,Object> map = scheduleService.getRuleSchedule(page,limit,hospcode,depcode);
       return Result.ok(map);
    }

    //根据医院编号 、科室编号和工作日期，查询排班详细信息
    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail( @PathVariable String hoscode,
                                     @PathVariable String depcode,
                                     @PathVariable String workDate) {

        List<Schedule> list = scheduleService.getDetailSchedule(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
